import request from '../utils/request'
import Qs from 'qs'

export default {
  getAll () {
    return request.get('/api/tags')
  },
  create (name) {
    return request.post(
      '/api/tags',
      Qs.stringify({ name }),
      { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }
    )
  },
  update (id, name) {
    return request.put(
      '/api/tags/' + id,
      Qs.stringify({ id, name }),
      { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }
    )
  },
  remove (id) {
    return request.delete('/api/tags/' + id)
  }
}
